package org.liulinlin.sejw.db;

import java.sql.*;

public class Box {
	private String id;
	private CYInfo cyInfo;
	private String leadSealing;
	private String type;
	private double size;
	private boolean used;
	private String damage;
	private int status;
	private boolean made;
	private boolean declare;
	
	public Box() {
		
	}
	public Box(String id) {
		DBConnectionManager connMgr = DBConnectionManager.getInstance();
		Connection con = connMgr.getConnection("shipping_export");
		if (con == null) {
			System.out.println("Box不能获得数据库连接");
			return;
		}
		
		try {
			Statement stmt = con.createStatement();
			ResultSet rs = stmt.executeQuery("select * from Box where Box_ID = '" + id + "'");
			
			rs.next();
			this.id = id;
			cyInfo = new CYInfo(rs.getString("CY_ID"));
			leadSealing = rs.getString("Box_LeadSealing");
			type = rs.getString("Box_Type");
			size = rs.getDouble("Box_Size");
			used = rs.getBoolean("Box_Used");
			damage = rs.getString("Box_Damage");
			status = rs.getInt("Box_Status");
			made = rs.getBoolean("Box_Made");
			declare = rs.getBoolean("Box_Declare");
		} catch (SQLException e) {
			e.printStackTrace();
		}
		
		connMgr.freeConnection("shipping_export", con);
		connMgr.release();
	}
	
	public void setId(String id) {
		this.id = id;
	}
	public void setCYInfo(CYInfo cyInfo) {
		this.cyInfo = cyInfo;
	}
	public void setLeadSealing(String leadSealing) {
		this.leadSealing = leadSealing;
	}
	public void setType(String type) {
		this.type = type;
	}
	public void setSize(double size) {
		this.size = size;
	}
	public void setUsed(boolean used) {
		this.used = used;
	}
	public void setDamage(String damage) {
		this.damage = damage;
	}
	public void setStatus(int status) {
		this.status = status;
	}
	public void setMade(boolean made) {
		this.made = made;
	}
	public void setDeclare(boolean declare) {
		this.declare = declare;
	}
	
	public String getId() {
		return id;
	}
	public CYInfo getCYInfo() {
		return cyInfo;
	}
	public String getLeadSealing() {
		return leadSealing;
	}
	public String getType() {
		return type;
	}
	public double getSize() {
		return size;
	}
	public boolean getUsed() {
		return used;
	}
	public String getDamage() {
		return damage;
	}
	public int getStatus() {
		return status;
	}
	public boolean getMade() {
		return made;
	}
	public boolean getDeclare() {
		return declare;
	}
}
